package webserver;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class WebServer {
ServerSocket serverSocket;

	public static void main(String[] args) throws IOException {
		new WebServer().run();
		
		

	}
	
	
	public void run() throws IOException{
		System.out.println("The server is started");
		serverSocket=new ServerSocket(6546);//port number at which server is running
		//for accepting request
		acceptRequest();
		
	}
	public void acceptRequest() throws IOException{
		while(true){
			Socket socket=serverSocket.accept();
			ConnectionHandler ch=new ConnectionHandler(socket);
		
			//ch is the thread, so we have to start our thread
			ch.start();// this will call the run method automatically
			
		}
		
		
		
		
		
		
	}

}
